package edu.nju.mutest.combination;

import com.github.javaparser.ast.CompilationUnit;
import edu.nju.mutest.mutator.Mutator;
import edu.nju.mutest.mutator.factory.MutatorFactory;
import edu.nju.mutest.util.CompilationUnitUtil;

import java.util.List;

/**
 * if there are two mutators. mutator A generates x1 mutants from source file, mutator B generate x2 mutants from source
 * file. After combination use AddStrategy, there are x1 + x2 mutants - just put together the mutants from A and B.
 */
public class AddStrategy implements MutatorCombinationStrategy{

    @Override
    public void generateMutants(List<CompilationUnit> mutantList, CompilationUnit source, MutatorFactory mf) {
        Mutator mutator = mf.newInstance(CompilationUnitUtil.clone(source));
        mutantList.addAll(mutator.mutate());
    }
}
